package kr.hkit.androidcomplete01.ch06;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class RelativeParameter extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		RelativeLayout relative = new RelativeLayout(this);
		
		TextView textchul = new TextView(this);
		textchul.setText("철수");
		textchul.setTextSize(30);
		textchul.setId(1);
		
		RelativeLayout.LayoutParams paramschulsu = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
		paramschulsu.setMargins(0, 0, 20, 0);
		relative.addView(textchul, paramschulsu);
		
		TextView textyoung = new TextView(this);
		textyoung.setTextSize(20);
		textyoung.setText("영희");
		textyoung.setId(2);
		
		RelativeLayout.LayoutParams paramsyoung = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
		paramsyoung.addRule(RelativeLayout.RIGHT_OF, textchul.getId());
		relative.addView(textyoung, paramsyoung);
		
		TextView textmong = new TextView(this);
		textmong.setTextSize(30);
		textmong.setText("몽룡");
		textmong.setId(3);
		
		RelativeLayout.LayoutParams paramsmong = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
		paramsmong.addRule(RelativeLayout.BELOW, textyoung.getId());
		paramsmong.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
		paramsmong.setMargins(10, 0, 0, 0);
		relative.addView(textmong, paramsmong);
		
		TextView textchun = new TextView(this);
		textchun.setTextSize(20);
		textchun.setText("춘향");
		
		RelativeLayout.LayoutParams paramschun = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
		paramschun.addRule(RelativeLayout.LEFT_OF, textmong.getId());
		paramschun.addRule(RelativeLayout.ALIGN_BOTTOM, textmong.getId());
		relative.addView(textchun, paramschun);
		
		setContentView(relative);
	}
}
